package com.htsk.city.services.core.dao;

import com.htsk.city.services.core.domain.OrderMaster;
import com.htsk.city.services.core.entity.OrderVo;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface OrderMasterDao extends JpaRepository<OrderMaster, Long> {
    @Query(value = "select count(*) from order_master a INNER JOIN order_item b on a.order_id=b.order_id \n" +
            "where a.is_deleted=0\n" +
            "and a.user_id=?1 \n" +
            "and b.technician_id=?2 and b.service_sub_category_id=?3 and a.order_status in (?4)",nativeQuery = true)
    int existsByUserIdAndTechnicianIdAndStatusIn(Long userId, Long technicianId,Long serviceSubCategoryId, List<Integer> orderStatus);

    OrderMaster findByOrderNo(String orderNo);

}
